<template>
  <div class="card" :style="{ height }">
    <div class="header">
      <div class="header-title">{{ title }}</div>
      <div class="header-subTitle">
        <slot name="subTitle">
          {{ subTitle }}
        </slot>
      </div>
    </div>
    <div
      class="body"
      :style="{
        padding,
      }"
    >
      <slot></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: "Card",
  props: {
    title: {
      type: String,
      default: "",
    },
    subTitle: {
      type: String,
      default: "",
    },
    padding: {
      type: String,
      default: "5px",
    },
    height: {
      type: String,
      default: "380px",
    },
  },
};
</script>

<style lang="scss" scoped>
.card {
  // width: 100%;
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;

  .header {
    // height: 30px;
    // line-height: 30px;
    overflow: hidden;

    &-title {
      float: left;
      position: relative;
      padding-left: 10px;
      font-size: 16px;
      font-weight: 600;
      color: #000;

      &:after {
        content: "";
        position: absolute;
        left: 0;
        top: 50%;
        margin-top: -6px;
        width: 3px;
        height: 12px;
        background: #15adf1;
        border-radius: 1px;
      }
    }

    &-subTitle {
      float: right;
      font-size: 12px;
    }
  }

  .body {
    width: 100%;
    padding: 5px;
    overflow: auto;
  }
}
</style>
